package com.david.rabbit.spring.xml.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.io.UnsupportedEncodingException;

/**
 * @author David
 * @version V1.0
 * @Package com.david.rabbit.spring.xml.listener
 * @date 2021/7/17 16:19
 */
public class DirectMessageListener implements MessageListener {

    @Override
    public void onMessage(Message message) {
        try {
            System.out.println("DirectMessageListener:"+new String(message.getBody(), message.getMessageProperties().getContentEncoding()));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }
}
